package org.wdcode.shop.po;

import java.io.Serializable;

import org.wdcode.back.po.BaseBackStateEntityBean;
import org.wdcode.common.tools.Conversion;
import org.wdcode.common.util.CommonUtil;
import org.wdcode.shop.helper.ProductSortHelper;

/**
 * 产品分类实体
 * @author WD
 * @since JDK6
 * @version 1.0 2009-11-23
 */
public final class ProductSort extends BaseBackStateEntityBean implements Serializable {
	// 序列化ID
	private static final long	serialVersionUID	= -2185071221516432805L;
	// 所属分类
	private Integer				belong;

	// 产品分类
	private ProductSort			sort;

	/**
	 * 设置产品分类实体
	 * @param sortId 产品分类ID
	 * @return 产品分类实体
	 */
	public ProductSort setSort(Integer sortId) {
		return sort = ProductSortHelper.getHelper().get(Conversion.toInt(sortId));
	}

	/**
	 * 获得产品分类实体
	 * @return 产品分类实体
	 */
	public ProductSort getSort() {
		return CommonUtil.isEmpty(sort) ? setSort(belong) : sort;
	}

	/**
	 * 获得所属分类
	 * @return 所属分类
	 */
	public Integer getBelong() {
		return this.belong;
	}

	/**
	 * 设置所属分类
	 * @param belong 所属分类
	 */
	public void setBelong(Integer belong) {
		this.belong = belong;
	}
}